import { defineStore } from 'pinia'

export const useCounterStore = defineStore({
  id: 'counter',
  state: () => ({
    counter: 1,
    age:1
  }),
  persist: {
    enabled: true,
    strategies: [
      {
        key: 'test',
        storage: localStorage,
        paths: ['counter']
      }
    ]
  },
  getters: {
    doubleCount() {
      return this.counter * 2
    },
    a: (state) => state.counter * 2
  },
  actions: {
    increment(a, b) {
      this.counter++
      this.age++
    }
  }
})
export const useCounterStore1 = defineStore({
  id: 'counter1',
  state: () => ({
    counter: 1,
    age:1
  }),
  persist: {
    enabled: true,
    strategies: [
      {
        key: 'test',
        storage: localStorage,
        paths: ['counter']
      }
    ]
  },
  getters: {
    doubleCount() {
      return this.counter * 2
    },
    a: (state) => state.counter * 2
  },
  actions: {
    increment(a, b) {
      this.counter++
      this.age++
    }
  }
})